﻿@model RTracker.Models.Common.CPaging

@{
    Int32 nPageSize = Model.PageSize;
    Int64 nNoOfPages = Model.TotalRecordsCount % nPageSize;
    if (nNoOfPages >= 1)
    {
        nNoOfPages = (Model.TotalRecordsCount / nPageSize) + 1;
    }
    else
    {
        nNoOfPages = Model.TotalRecordsCount / nPageSize;
    }
    string[] searchByValue = ViewData["SearchByValue"] as string[];
    string[] searchByText = ViewData["SearchByText"] as string[];
}


<div class="table-toolbar mnt_col">
    <div class="col-md-2 col-sm-4 mnt_btn">
        @if (ViewBag.bCanCreate == true)
        {
            <div class="btn-group col-md-2 col-xs-12">
                <button id="gd-new-id" class="btn green"><i class="fa fa-plus"></i></button>
            </div>
        }
        @if (ViewBag.bCanDelete == true)
        {
            <div class="btn-group col-md-2 col-xs-12">
                <button id="gd-delete-id" class="btn red gd-disabled-cls"><i class="fa fa-trash-o"></i></button>
            </div>
        }
    </div>
    <div style="width: 40% !important;padding-left: 0;padding-right: 0;float: left;">

        @if (ViewBag.bSearchEnabled == true)
        {
            <div style="width: 30% !important;padding-left: 0;padding-right: 0;float: left;">
                <select id="selsearchon" class="form-control">
                    @for (int i = 0; i < searchByText.Length; i++)
                    {
                        <option value="@searchByValue[i]">@searchByText[i]</option>
                    }
                </select>
            </div>
            <div class="input-icon right" style="margin-left: 2%;padding-left: 0px;padding-right: 0px;width: 66%;float: left;position: relative;}">
                <input id="txtsearchvalue" type="search" class="form-control input-medium input-inline" placeholder="Search" />
                <i class="fa fa-search" style="right: 8px;float: right;border: medium none;height: 23px;position: absolute;top: 0;color: #ccc;
                display: block;margin-right: 32px;margin-top: 8px;">
                    <input id="gd-Search-btn-id" name="Search" type="button" class="fa fa-search"
                           style="width: 5px !important;left: -10px;top: -10px;position: absolute;border: medium none;height: 30px;color: #fff;background: none;" />
                </i>
            </div>
        }

    </div>

    <div class="col-md-3" style="width:20%">
        @if (ViewBag.bPagingEnabled == true)
        {
            <label class="col-sm-4 mnt_pt7">Records:</label>
            <div class="col-sm-6 col-xs-12">
                <select id="sl-gd-page-size-id" class="paging-select form-control">
                    <option>5</option>
                    <option>10</option>
                    <option>15</option>
                </select>
            </div>
        }
    </div>

    <div class="col-md-3 mnt_rec">
        @if (ViewBag.bPagingEnabled == true)
        {
            <label class="col-sm-3 col-xs-4 mnt_pt7 mnt_pre">
                <a @if (@Model.PageNumber == 1) { <text> class="gd-disabled-cls" </text>             } id="ahr-gd-first-id" title="Go to First Page">First</a>
                <a id="ahr-gd-prev-id" title="Go to Previous Page" @if (@Model.PageNumber == 1) { <text> class="gd-disabled-cls mnt_lft fa fa-mail-reply" </text>             } else { <text> class="mnt_lft fa fa-mail-reply" </text>           }></a>
            </label>
            <div class="col-sm-5 col-xs-4">
                <select id="sl-gd-page-no-id" class="paging-select form-control">
                    @for (int i = 1; i <= nNoOfPages; i++)
                    {
                        <option>@i</option>
                    }
                </select>
            </div>
            <label class="col-sm-3 mnt_pt7 col-xs-4">
                <a @if (@Model.PageNumber == @nNoOfPages) { <text> class="gd-disabled-cls mnt_rgt fa fa-mail-forward" </text>          } else { <text> class="mnt_rgt fa fa-mail-forward" </text>            } id="ahr-gd-next-id" title="Go to Next Page"></a><a id="ahr-gd-last-id" title="Go to Last Page" @if (@Model.PageNumber == @nNoOfPages) { <text> class="gd-disabled-cls" </text>             }>Last</a>
            </label>
        }
    </div>
    <div class="btn-group pull-right col-xs-12 col-md-1">
        <button class="btn dropdown-toggle" data-toggle="dropdown">
            Tools <i class="fa fa-angle-down"></i>
        </button>
        <ul class="dropdown-menu pull-right">
            <li>
                <a href="#">
                    Print
                </a>
            </li>
            <li>
                <a href="#">
                    Save as PDF
                </a>
            </li>
            <li>
                <a href="#">
                    Export to Excel
                </a>
            </li>
        </ul>
    </div>
</div>





@* Hidden Section Containg the Partial View of Delete And Copy Dialog *@
<div class="gb-hidden-cls">
    @Html.Partial("../GridView/Dialogs/_DeleteDialog")
    @Html.Partial("../GridView/Dialogs/_CopyDialog")
</div>


<script>
    $("#sl-gd-page-no-id").val(@Model.PageNumber);

    $("#sl-gd-page-size-id").val(@Model.PageSize);

    $("#div-current-page-id").html(@Model.PageNumber);

    nGbCurrentPage = @Model.PageNumber

    nGbTotalPages = @nNoOfPages

</script>
